﻿Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class ObjektHinweisIcon
    Dim Frame As Integer = 0
    Dim Textur As Texture
    Dim Rechteck As Rectangle
    Public Sub New(ByVal neuVerwalter As Objektverwalter, ByVal neuTextur As String, ByVal Sound As String, ByVal XinFeldern As Integer, ByVal YinFeldern As Integer)
        Dim Bild As Bitmap = Image.FromFile(DataSettings.Resourcenpfad + "Pfeile\" + neuTextur + ".png")
        Rechteck = New Rectangle(XinFeldern * 16 + Hauptmenue.Feldbreite / 2, YinFeldern * 16 - Hauptmenue.Feldbreite / 2, Bild.Width, Bild.Height)
        Textur = Grafikengine.LoadTexture(Bild)
        If My.Computer.FileSystem.FileExists(DataSettings.Resourcenpfad + "Sound\Sound Effects\" + Sound + ".wav") Then
            MusikEngine.LoadWav(DataSettings.Resourcenpfad + "Sound\Sound Effects\" + Sound + ".wav", False)
        End If
    End Sub
    Public Function Malen() As Boolean
        Dim intColor As Color = Color.FromArgb(255, 255, 255, 255)
        Grafikengine.recBild = Nothing
        Grafikengine.szfScale = Nothing
        Grafikengine.ptfRotCenter = New Point(0, 0)
        Grafikengine.ptfPosition = New Point(Rechteck.X + Objektverwalter.Spielfeld.BildschirmKooX, Rechteck.Y + Objektverwalter.Spielfeld.BildschirmKooY)
        Grafikengine.Sprite.Draw2D(Textur, Grafikengine.recBild, Grafikengine.szfScale, Grafikengine.ptfRotCenter, 0, Grafikengine.ptfPosition, intColor)
        If Frame >= 5 Then
            Textur.Dispose()
            Grafikengine.Grafikkarte.EvictManagedResources()
            Return True
        End If
        Frame += 1
        Return False
    End Function
End Class
